package com.maisuiit.pattern.singleton;

/**
 * 饿汉式
 * @author zhangcc
 * @date 2021-07-13
 */
public class Singleton {

    // 类初始化时,会立即加载该对象，线程安全,调用效率高
    private static Singleton singleton = new Singleton();

    public Singleton() {
        System.out.println("私有Singleton构造参数初始化");
    }

    public static Singleton getInstance() {
        return singleton;
    }

}
